package com.ruoyi.customer.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.customer.domain.Dragging;
import com.ruoyi.customer.mapper.DraggingMapper;
import com.ruoyi.customer.service.DraggingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:zzm
 * @Date: 2024/9/2 10:43
 */
@Service
public class DraggingServiceImpl extends ServiceImpl<DraggingMapper, Dragging> implements DraggingService {

    @Autowired
    private DraggingMapper draggingMapper;

    /**
     * 获取列表
     * @return
     */
    @Override
    public List<Dragging> getList() {
        List<Dragging> list = draggingMapper.getList();
        return list;
    }

    /**
     * 新增和修改
     * @param ro
     * @return
     */
    @Override
    public Boolean addOrUpdate(Dragging ro) {
        if(ro.getId()!=null){
            this.updateById(ro);
        }else{
            this.save(ro);
        }
        return true;
    }

    /**
     * 删除放入回收站
     * @param ids
     */
    @Override
    public void delete(Long[] ids) {
        for (int i = 0; i < ids.length; i++) {
            draggingMapper.deleteByIds(ids[i]);
        }
    }
}
